﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace WebUI.EasyUI
{
    /// <summary>
    /// DataGridHandler 的摘要说明
    /// </summary>
    public class DataGridHandler : IHttpHandler
    {

        public void ProcessRequest(HttpContext context)
        {
            String s = "";
            int page =int.Parse(context.Request.Form["page"]);
            int rows = int.Parse(context.Request.Form["rows"]);
            if(page == 1)
            {
              s = "{\"total\":20,\"rows\":[" +
           "{\"code\":\"001\",\"name\":\"白菜\",\"price\":\"19\"}," +
           "{\"code\":\"002\",\"name\":\"苹果\",\"price\":\"90\"}," +
           "{\"code\":\"003\",\"name\":\"香蕉\",\"price\":\"890\"}," +
           "{\"code\":\"004\",\"name\":\"鸡肉\",\"price\":\"69\"}," +
           "{\"code\":\"005\",\"name\":\"鱼\",\"price\":\"57\"}" +
           "]}";
            }
            if(page == 2)
            {
                s = "{\"total\":20,\"rows\":[" +
"{\"code\":\"006\",\"name\":\"白菜006\",\"price\":\"19\"}," +
"{\"code\":\"007\",\"name\":\"苹果007\",\"price\":\"90\"}," +
"{\"code\":\"008\",\"name\":\"香蕉008\",\"price\":\"890\"}," +
"{\"code\":\"009\",\"name\":\"鸡肉009\",\"price\":\"69\"}," +
"{\"code\":\"010\",\"name\":\"鱼010\",\"price\":\"57\"}" +
"]}";
            }

            context.Response.Write(s);
            context.Response.End();
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}